package com.example.demo.controller;

import com.example.demo.entity.RegisterEntity;
import com.example.demo.result.Result;
import com.example.demo.result.ResultUtil;
import com.example.demo.service.RegisterService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
public class RegisterController {

    @Autowired
    private RegisterService registerService;

    //获取已制证人员信息
    @GetMapping("/getCertified")
    public Result getCertified(RegisterEntity registerEntity){
        return registerService.getCertified(registerEntity);
    }
    //根据姓名获取登数据
    @GetMapping("/selectByName")
    public Result selectByName(String name){
        return registerService.selectByName(name);
    }
    //按要求获取登记数据
    @RequestMapping("/getRegistered")
    public Result registered( RegisterEntity registerEntity){
        return  registerService.getRegisterData(registerEntity);
    }
    //查询行业或工种
    @GetMapping("/getIndOrWorkT")
    public Result selectIndOrWorkT(String item){
        return registerService.selectIndOrWorkT(item);
    }

    //获取未制证人员信息
    @GetMapping("/getWithoutCertify")
    public Result getWhetherCertify(int pageIndex,int pageSize){
        return registerService.getWhetherCertify(pageIndex,pageSize);
    }
    //登记
    @PostMapping("/registerData")
    public Result registerData( @RequestBody RegisterEntity registerEntity){
        return registerService.registerData(registerEntity);
    }

    @PostMapping("/updateRegisterMsg")
    public Result updateRegisterMsg(@RequestBody RegisterEntity registerEntity){
        return registerService.updateRegisterMsg(registerEntity);
    }
    //插入测试数据
    @PostMapping("/testInsert")
    public Result testInsert(@RequestBody RegisterEntity registerEntity){
        registerService.testInsert(registerEntity);
        return null;
    }
}
